From: Will Thompson Date: Fri, 21 Jun 2019 09:47:40 +0000 (+0100) Subject: network: don't assume NMActiveConnection has a device X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~845^2^2~133 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=94ba52af0c52f789cb8cf81e1500765d0cbba98b;p=gnome-shell.git network: don't assume NMActiveConnection has a device In practice this has been seen to fail: JS ERROR: TypeError: active.get_devices(...)[0] is undefined ensureActiveConnectionProps@resource:///org/gnome/shell/ui/status/network.js:73:22 _getMainConnection@resource:///org/gnome/shell/ui/status/network.js:1791:13 _syncMainConnection@resource:///org/gnome/shell/ui/status/network.js:1809:32 https://gitlab.gnome.org/GNOME/gnome-shell/issues/1406 --- diff --git a/js/ui/status/network.js b/js/ui/status/network.js index 4ab82e9f2..7c2499d0e 100644 --- a/js/ui/status/network.js +++ b/js/ui/status/network.js @@ -69,9 +69,12 @@ function ssidToLabel(ssid) { function ensureActiveConnectionProps(active, client) { if (!active._primaryDevice) { - // This list is guaranteed to have only one device in it. - let device = active.get_devices()[0]._delegate; - active._primaryDevice = device; + let devices = active.get_devices(); + if (devices.length > 0) { + // This list is guaranteed to have at most one device in it. + let device = devices[0]._delegate; + active._primaryDevice = device; + } } }